package app.mvc.view.components.panels
{
	import alternativa.gui.container.Container;
	import alternativa.gui.controls.dropDownMenu.DropDownMenuGroup;
	import alternativa.gui.data.DataProvider;
	import alternativa.gui.event.DropDownMenuEvent;
	import alternativa.gui.event.ListEvent;
	import alternativa.gui.event.RadioButtonGroupEvent;
	import alternativa.gui.theme.defaulttheme.container.panel.Panel;
	import alternativa.gui.theme.defaulttheme.controls.dropDownMenu.DropDownMenu;
	import alternativa.gui.theme.defaulttheme.controls.dropDownMenu.DropDownMenuItem;
	
	import app.mvc.model.VO.LabelVO;
	
	import flashx.textLayout.elements.ListElement;
	
	import org.puremvc.as3.patterns.facade.Facade;
	import org.puremvc.as3.patterns.observer.Notification;
	
	public class LabelsBar extends Container
	{
		public var dropDownMenu:DropDownMenu;
		
		public function LabelsBar()
		{
			super();

			init();
		}
		
		private function init():void
		{			
			// drop-down menu
			dropDownMenu = new DropDownMenu();
			dropDownMenu.openPanelDelay=0;
			
			dropDownMenu.buttonsHeight = 25;
			addChild(dropDownMenu);
			_freezeHeight=true;
			
			
			dropDownMenu.addEventListener(DropDownMenuEvent.SELECT,onSelectItem);
		}
		
		private function onSelectItem(evt:DropDownMenuEvent):void
		{
			var vo:LabelVO = evt.data as LabelVO;
			Facade.getInstance().sendNotification(vo.command);
		}

		public function set model($data:DataProvider):void
		{
			dropDownMenu.dataProvider = $data;
		}

		
		override protected function draw():void
		{
			super.draw();
			dropDownMenu.width = width;
			
		}
	}
}